﻿using Lazy.Captcha.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using RuoVea.ExApp;

namespace RuoVea.ExCaptcha;

/// <summary>
/// 
/// </summary>
public static class LazyCaptchaSetup
{
    /// <summary>
    /// 验证码初始化
    /// </summary>
    /// <param name="services"></param>
    public static void AddExCaptcha(this IServiceCollection services)
    {
        services.AddCaptcha(App.Configuration);
        services.AddScoped<ICaptcha, RandomCaptcha>();
    }

    /// <summary>
    /// 验证码初始化
    /// </summary>
    /// <param name="services"></param>
    /// <param name="configuration"></param>
    public static void AddExCaptcha(this IServiceCollection services, IConfiguration configuration)
    {
        services.AddCaptcha(configuration);
        services.AddScoped<ICaptcha, RandomCaptcha>();
    }
}
